@@ -11,17 +11,11 @@ import android.widget.ImageView; |
||
| 11 | 11 |
import android.widget.TextView; |
| 12 | 12 |
import android.widget.Toast; |
| 13 | 13 |
|
| 14 |
-import com.android.common.utils.LogHelper; |
|
| 15 | 14 |
import com.android.views.progressbar.ProgressWheel; |
| 16 | 15 |
|
| 17 |
-import java.io.File; |
|
| 18 |
- |
|
| 19 | 16 |
import ai.pai.lensman.R; |
| 20 | 17 |
import ai.pai.lensman.activities.WebViewActivity; |
| 21 |
-import ai.pai.lensman.dslr.CameraJNIInterface; |
|
| 22 | 18 |
import ai.pai.lensman.main.MainActivity; |
| 23 |
-import ai.pai.lensman.service.Constants; |
|
| 24 |
-import ai.pai.lensman.utils.ImageLoaderUtils; |
|
| 25 | 19 |
import butterknife.BindView; |
| 26 | 20 |
import butterknife.ButterKnife; |
| 27 | 21 |
import butterknife.OnClick; |
@@ -32,7 +26,7 @@ public class LoginActivity extends FragmentActivity implements LoginContract.Vie |
||
| 32 | 26 |
@BindView(R.id.tv_agree_protocol) TextView protocolText; |
| 33 | 27 |
@BindView(R.id.iv_login_logo) ImageView photoView; |
| 34 | 28 |
private LoginContract.Presenter presenter; |
| 35 |
- private boolean isCancelled; |
|
| 29 |
+ |
|
| 36 | 30 |
|
| 37 | 31 |
@Override |
| 38 | 32 |
protected void onCreate(Bundle savedInstanceState) {
|
@@ -43,47 +37,8 @@ public class LoginActivity extends FragmentActivity implements LoginContract.Vie |
||
| 43 | 37 |
content.setSpan(new UnderlineSpan(), 6, content.length(), 0); |
| 44 | 38 |
protocolText.setText(content); |
| 45 | 39 |
presenter = new LoginPresenter(this,this); |
| 46 |
- int ret = CameraJNIInterface.getInstance().mygpcamerainit(); |
|
| 47 |
- if(ret>=0){
|
|
| 48 |
- String text = CameraJNIInterface.getInstance().mygpcameragetsummary(); |
|
| 49 |
- LogHelper.d("czy","text="+text);
|
|
| 50 |
- protocolText.setText("text="+text);
|
|
| 51 |
-// Toast.makeText(this,text,Toast.LENGTH_LONG).show(); |
|
| 52 |
- }else{
|
|
| 53 |
- LogHelper.d("czy","ret="+ret);
|
|
| 54 |
-// Toast.makeText(this,"camera init return "+ret,Toast.LENGTH_LONG).show(); |
|
| 55 |
- protocolText.setText("camera init return "+ret);
|
|
| 56 |
- } |
|
| 57 |
- File dir = new File(Constants.APP_IMAGE_DIR); |
|
| 58 |
- dir.mkdirs(); |
|
| 59 |
- fetchPhotoTask(); |
|
| 60 | 40 |
} |
| 61 | 41 |
|
| 62 |
- private void fetchPhotoTask(){
|
|
| 63 |
- new Thread(new Runnable() {
|
|
| 64 |
- @Override |
|
| 65 |
- public void run() {
|
|
| 66 |
- while (!isCancelled){
|
|
| 67 |
- final String photoName = CameraJNIInterface.getInstance().mygpcamerawaitforevent(Constants.APP_IMAGE_DIR); |
|
| 68 |
- LogHelper.d("czy","mygpcamerawaitforevent return "+photoName);
|
|
| 69 |
- photoView.post(new Runnable() {
|
|
| 70 |
- @Override |
|
| 71 |
- public void run() {
|
|
| 72 |
- protocolText.setText("mygpcamerawaitforevent return "+photoName);
|
|
| 73 |
- if(photoName!=null && photoName.length()>0){
|
|
| 74 |
- String sub = photoName.substring(0,1); |
|
| 75 |
- if(TextUtils.isDigitsOnly(sub)){
|
|
| 76 |
- ImageLoaderUtils.displayLocalImage(Constants.APP_IMAGE_DIR+File.separator+photoName,photoView,ImageLoaderUtils.getOptions(R.drawable.login_page_logo)); |
|
| 77 |
- } |
|
| 78 |
- } |
|
| 79 |
- |
|
| 80 |
- } |
|
| 81 |
- }); |
|
| 82 |
- } |
|
| 83 |
- } |
|
| 84 |
- }).start(); |
|
| 85 |
- |
|
| 86 |
- } |
|
| 87 | 42 |
|
| 88 | 43 |
@Override |
| 89 | 44 |
protected void onResume() {
|
@@ -94,8 +49,6 @@ public class LoginActivity extends FragmentActivity implements LoginContract.Vie |
||
| 94 | 49 |
@Override |
| 95 | 50 |
protected void onDestroy() {
|
| 96 | 51 |
super.onDestroy(); |
| 97 |
- CameraJNIInterface.getInstance().mygpcameraexit(); |
|
| 98 |
- isCancelled = true; |
|
| 99 | 52 |
} |
| 100 | 53 |
|
| 101 | 54 |
@OnClick(R.id.btn_login) |